home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / util / libs / zee_inilib.lha / ini_library / include / libraries / ini_lib.h next >
Encoding:
C/C++ Source or Header  |  1999-03-27  |  3.1 KB  |  107 lines

  1. #ifndef LIBRARIES_INI_LIB_H
  2. #define LIBRARIES_INI_LIB_H
  3. /*
  4. **    $VER: ini_lib.h 31.00 (16.03.98)
  5. **
  6. **    Standard C header for ini.library
  7. **
  8. **    by Basty/Seasons.
  9. **
  10. **      Copyright © 1999 Seasons.
  11. **        All Rights Reserved
  12. **
  13. */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include "exec/types.h"
  17. #endif
  18.  
  19. #ifndef EXEC_LISTS_H
  20. #include "exec/lists.h"
  21. #endif
  22.  
  23. #ifndef EXEC_LIBRARIES_H
  24. #include "exec/libraries.h"
  25. #endif
  26.  
  27. #ifndef EXEC_DOS_H
  28. #include "dos/dos.h"
  29. #endif
  30.  
  31. /* iniLibBase */
  32. struct iniLibBase
  33. {
  34.     struct Library LibNode;
  35.  
  36.     BPTR    SegList;                    /* Segment list */
  37.     APTR    ExecBase;                    /* ExecBase */
  38.     APTR    DOSBase;                    /* DOSBase */
  39.     APTR    MemPool;                    /* Memory pool for iniAllocPMem() */
  40.     APTR    MemSigSem;                    /* Memory pool signal semaphore */
  41. };    /* iniLibBase */
  42.  
  43. /* Flags passable to iniReadxxx(), iniGetxxx() and iniFindxxx() */
  44. #define INIB_ContextCase        0L        /* If set, use case sensitive scan
  45.                                            for Context names */
  46. #define INIF_ContextCase        1L
  47. #define    INIB_ContextItemCase    1L        /* If set, use case sentitive scan
  48.                                            for Context item name */
  49. #define INIF_ContextItemCase    2L
  50.  
  51. /* Format parameter of iniIntToStr() */
  52.  
  53. #define INI_FORMAT_DEC        0L            /* Use decimal with no precedor */
  54. #define INI_FORMAT_DEC_CHAR    1L            /* Use decimal with # precedor */
  55. #define INI_FORMAT_HEX        2L            /* Use hexadical with $ precedor */
  56. #define INI_FORMAT_HEX_0X    3L            /* Use hexadical with 0x precedor */
  57. #define INI_FORMAT_BIN        4L            /* Use binary with % precedor */
  58. #define INI_FORMAT_OCT        5L            /* Use octal with & precedor */
  59. #define    INI_FORMAT_YESNO    6L            /* Use No for zero, Yes for others */
  60. #define    INI_FORMAT_YN        7L            /* Use N for zero, Y for others */
  61. #define    INI_FORMAT_TRUEFALSE    8L        /* Use False for zero, True others */
  62. #define    INI_FORMAT_ONOFF        9L        /* Use Off for zero, On for others */
  63. #define INI_UNSIGNED        0x80000000    /* Add this to the others to get
  64.                                            unsigned values */
  65.  
  66. /* Floating point format of iniStrToFloat() and iniFloatToStr()
  67.    Upper word: Integer part.
  68.    Lower word: 1/65536 of value.
  69.    Example:
  70.    $00048000 means 4.5 ($8000/$10000 = 0.5)
  71.    $fffc0000 means -4.0 (if treated as signed)
  72.    $fffc8000 means -3.5 (if treated as signed) */
  73.  
  74. /* Format parameter of iniFloatToStr() */
  75.  
  76. #define INI_FLOAT_FORMAT_DEC    0L            /* Use decimal with point
  77.                                                separator */
  78. #define INI_FLOAT_UNSIGNED        0x80000000    /* Add this to the others to get
  79.                                                unsigned values */
  80.  
  81. /* The following structure is for each file opened by iniOpenFile() or
  82.    iniOpenMem(). */
  83.  
  84. struct iniFile {
  85.     struct    MinList Context;                /* Linked list of the contexts. */
  86.     struct    MinList PreLines;                /* Lines before the first context. */
  87. };
  88.  
  89. /* The following structure is for each context in the .INI file. */
  90.  
  91. struct iniContext {
  92.     struct    MinNode Node;                /* ini.library context chunk */
  93.     struct    MinList Lines;                /* Lines belonging to this context */
  94.     APTR    ContextLine;                /* Context line */
  95. };
  96.  
  97. /* The following structure is for each line in the .INI file. */
  98.  
  99. struct iniContextItemLine {
  100.     struct    MinList Node;                /* ini.library config line chunk */
  101.     APTR    Line;                        /* Line contents (incl. CR/LF) */
  102. };
  103.  
  104. #define    ININame "ini.library"
  105.  
  106. #endif /* LIBRARIES_INI_LIB_H */
  107.